import { createRouter, createWebHistory } from 'vue-router'

const routes = [
  {
    path: '/',
    redirect: '/login',
  },
  {
    path: '/login',
    component: () => import('@/views/login/loginView.vue'),
  },
  {
    path: '/register',
    component: () => import('@/views/register/registerView.vue'),
  },
  {
    path: '/home',
    component: () => import('@/views/home/homeView.vue'),
    redirect: '/college',
    children: [
      {
        path: '/college',
        component: () => import('@/views/college/collegeView.vue'),
      },
      {
        path: '/student/list',
        component: () => import('@/views/student/listView.vue'),
      },
      {
        path: '/dorm/list',
        component: () => import('@/views/dormitorie/dormitorieView.vue'),
      },
      {
        path: '/repair',
        component: () => import('@/views/repair/repairView.vue'),
      },
      {
        path: '/notice',
        component: () => import('@/views/notice/noticeView.vue'),
      },
    ],
  },
]

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes,
})

export default router
